package com.financing.platform.service.impl;


import com.financing.platform.dao.IFpOrderCostDao;
import com.financing.platform.dto.FpOrderCostDTO;
import com.financing.platform.service.IFpOrderCostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.List;

/**
 * fp_order_cost  
 * 订单费用表(打款结佣) 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpOrderCostService")
public class FpOrderCostServiceImpl implements IFpOrderCostService {

	@Autowired
	private IFpOrderCostDao fpOrderCostDao;

	@Override
	public String insert(FpOrderCostDTO fpOrderCost) throws SQLException {
		fpOrderCost.setDeleteTag("1");
		return fpOrderCostDao.insert(fpOrderCost);
	}

	@Override
	public void update(FpOrderCostDTO fpOrderCost) throws SQLException {
		fpOrderCostDao.update(fpOrderCost);
	}

	@Override
	public void updateForce(FpOrderCostDTO fpOrderCost) throws SQLException {
		fpOrderCostDao.updateForce(fpOrderCost);
	}

	@Override
	public void delete(String id) throws SQLException {
		fpOrderCostDao.delete(id);
	}
	
	@Override
	public List<FpOrderCostDTO> queryList(FpOrderCostDTO fpOrderCost) throws SQLException {
		return fpOrderCostDao.queryList(fpOrderCost);
	}

	@Override
	public int queryListCount(FpOrderCostDTO fpOrderCost) throws SQLException {
		return fpOrderCostDao.queryListCount(fpOrderCost);
	}

	@Override
	public FpOrderCostDTO loadById(String id) throws SQLException {
		return fpOrderCostDao.loadById(id);
	}
 	@Override
	public FpOrderCostDTO queryListGetFirst(FpOrderCostDTO fpOrderCost)
			throws SQLException {
		 List<FpOrderCostDTO> queryList = queryList(fpOrderCost);
		 if(queryList==null||queryList.size()==0){
			 return new FpOrderCostDTO();
		 }
		 return queryList.get(0);
	}
}
